// const BASE_URL = 'http://www.wjz.ink:3306'
//设置本地接口地址
const BASE_URL = 'http://localhost:3306'
export const myRequest = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: BASE_URL + options.url,
			method: options.method || 'GET',
			data: options.data || {},
			success: function(res) {
				if (res.data.status !== 200) {
					return uni.showToast({
						title: '获取数据失败'
					})
				}
				resolve(res)
			},
			fail: function(err) {
				uni.showToast({
					title: '请求接口失败'
				})
				reject(err)
			}
		})
	}).catch((e) => {})
}
//设置学校接口地址
const SCHOOL_URL = 'https://jwxt.gdupt.edu.cn/'
export const schoolRequest = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: SCHOOL_URL + options.url,
			method: options.method || 'GET',
			data: options.data || {},
			header: options.header || {},
			success: options.success,
			fail: options.fail
		})
	}).catch((e) => {})
}
